Skip to content

Playwright: Extend coverage to Contributor Discussion forums & threads #6626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

emilghittasv
Copy link
Collaborator

This pull request includes significant updates to the Playwright tests, mainly focusing on adding new test suites, enhancing utility functions, and introducing new classes for handling contributor discussions threads.

In highlight:

  • Extended the playwright coverage over the contributor discussion forum page & threads.

In test_contributor_discussions_page.py we are covering:

  1. Verifying that the description for each available forum is the correct one.
  2. Verifying that the side-navbar options are redirecting the user to the correct forum page.
  3. Verifying that links attached to the forum thread titles are redirecting the user to the correct forum page.
  4. Verifying that the Forum Moderators is available only for users that have the necessary permissions.
  5. Verifying that the number of threads & last post information successfully reflects the changes inside the forum (adding & removing threads) and also verifying that the correct post time & author is displayed.
  6. Verifying that moving a thread from one forum to another is successfully reflected inside the Contributor Discussions table.
  7. Verifying that the Contributor Discussions page breadcrumbs are redirecting the user to the correct page.
  8. Verifying that the "Last post" links are redirecting the user to the correct page.

In test_contributor_discussions_threads.py

  1. Verifying the validation applied to the title and body fields inside the new thread page.
  2. Verifying that only the thread owner & users which have the necessary permissions can edit the thread title and the edit is successfully reflected in both the thread page & inside the forum thread listing page.
  3. Verifying that threads can be deleted only by users which have the necessary permissions and the deletion is reflected inside the forum thread listing page.
  4. Verifying that the thread locking & unlocking mechanism is available only for users which have the necessary permissions and this is reflected inside the thread page successfully (the reply textarea field is no longer available, the "Locked" status is displayed inside the thread metadata, the correct options are listed inside the thread side-navbar & the thread lock image is displayed inside thread listing page for locked threads.
  5. Verifying that the Sticky & Unsticky this thread functionality is available only for users which have the necessary permissions and that the "Sticky" thread metadata information, correct side-navbar options & the sticky image inside the thread listing page is successfully displayed.
  • A couple of page objects, page messages, flows and utility functions were created for these & future tests.
  • The new tests have been added inside the playwright.yml for execution.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.

self.new_thread_page.click_on_cancel_button()
else:
self.new_thread_page.click_on_post_thread_button()
return re.search(r'last=(\d+)', self.utilities.get_page_url()).group(1)
Copy link
Preview

Copilot AI Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of re.search without checking if a match was found may lead to an AttributeError if the URL does not contain the expected 'last=' parameter. Consider verifying the match result before calling group(1).

Suggested change
return re.search(r'last=(\d+)', self.utilities.get_page_url()).group(1)
match = re.search(r'last=(\d+)', self.utilities.get_page_url())
if match:
return match.group(1)
else:
raise ValueError("The URL does not contain the expected 'last=' parameter.")

Copilot uses AI. Check for mistakes.

@emilghittasv emilghittasv merged commit 0013f8a into mozilla:main Apr 14, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants